from django.conf.urls import patterns, include, url
from django.views.generic import RedirectView
from sent.auth.authorize import Authorize
from sent.group.create import CreateGroup
from sent.group.add_user import AddUserToGroup
from sent.group.remove_user import RemoveUserFromGroup
from sent.group.get_group_users import GetGroupUsers
from sent.opinion.create_base_opinion import CreateBaseOpinion
from sent.view.list_opinions import ListOpinions
from sent.opinion.create_opinion import CreateOpinion
from sent.opinion.get_opinion import GetOpinion
from sent.opinion.delete_base_opinion import DeleteBaseOpinion
from sent.opinion.update_opinion import UpdateOpinion
from sent.group.get_user_groups import GetUserGroups
from sent.opinion.delete_opinion import DeleteOpinion
from sent.view.create_view import CreateView
from sent.view.delete_view import DeleteView
from sent.view.add_opinions import AddOpinions
from sententialyzer import settings
import os
from sent.opinion.get_user_opinions import GetUserOpinions
from sent.opinion.get_path_to_opinion import GetPathToOpinion
from sent.opinion.process_nested_set import ProcessNestedSet


#  Uncomment the next two lines to enable the admin:
#  from django.contrib import admin
#  admin.autodiscover()

urlpatterns = patterns('',
    
    #(r'^$', RedirectView.as_view(url='/static/articles/index.html')),
    
    (r'^auth/authorize$', Authorize.as_view()),
    
    (r'^group/create$', CreateGroup.as_view()),
    (r'^group/add_user$', AddUserToGroup.as_view()),
    (r'^group/remove_user$', RemoveUserFromGroup.as_view()),
    (r'^group/get_group_users$', GetGroupUsers.as_view()),
    (r'^group/get_user_groups$', GetUserGroups.as_view()),
    
    (r'^opinion/create_base_opinion$', CreateBaseOpinion.as_view()),
    (r'^opinion/delete_base_opinion$', DeleteBaseOpinion.as_view()),
    (r'^opinion/create_opinion$', CreateOpinion.as_view()),
    (r'^opinion/get$', GetOpinion.as_view()),
    (r'^opinion/update$', UpdateOpinion.as_view()),
    (r'^opinion/delete$', DeleteOpinion.as_view()),
    (r'^opinion/get_user_opinions$', GetUserOpinions.as_view()),
    (r'^opinion/get_path_to_opinion$', GetPathToOpinion.as_view()),
    
    (r'^opinion/process_nested_set$', ProcessNestedSet.as_view()),
    
    
    (r'^view/list_opinions$', ListOpinions.as_view()),
    (r'^view/create$', CreateView.as_view()),
    (r'^view/delete$', DeleteView.as_view()),
    (r'^view/add_opinions$', AddOpinions.as_view()),
    
    
    
    #  Examples:
    #  url(r'^$', 'sententialyzer.views.home', name='home'),
    #  url(r'^sententialyzer/', include('sententialyzer.foo.urls')),

    #  Uncomment the admin/doc line below to enable admin documentation:
    #  url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    #  Uncomment the next line to enable the admin:
    #  url(r'^admin/', include(admin.site.urls)),
)
if settings.DEBUG:
    urlpatterns += patterns('',
        (r'^articles/(?P<path>.*)$', 'django.views.static.serve', 
         {'document_root': os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + '/../../../example/articles')})
    )